<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return redirect('/blog');
});
Route::get('/user','IndexController@index');
Route::get('/blog','Home\BlogController@index')->name('blog.home');
Route::get('blog/{slug}','Home\BlogController@showPost')->name('blog.detail');
//后台路由
Route::get('/admin',function(){
    return redirect('admin/post');
});
Route::middleware('auth')->namespace('Admin')->group(function(){
        Route::resource('admin/post','PostController',['except'=>'show']);
        Route::resource('admin/tag','TagController',['except'=>'show']);
        Route::get('admin/upload','UploadController@index');
        Route::post('admin/upload/file','UploadController@uploadFile');
        Route::delete('admin/upload/file','UploadController@deleteFile');
        Route::post('admin/upload/folder','UploadController@createFolder');
        Route::delete('admin/upload/folder','UploadController@deleteFolder');
});
//登录退出
Route::get('/login','Auth\LoginController@showLoginForm')->name('login');
Route::post('/login','Auth\LoginController@login');
Route::get('logout','Auth\LoginController@logou')->name('logout');